#!/usr/bin/env bash

# acme.sh
export LE_WORKING_DIR="${HOME}/.acme.sh"

alias acme='${HOME}/.acme.sh/acme.sh'
alias acme.sh='acme'
alias acme.install='curl https://get.acme.sh | sh'

alias acme.list='acme.sh --list'
alias acme.issue='acme.sh --issue'
alias acme.revoke='acme.sh --revoke'
alias acme.renew='acme.sh --renew'
alias acme.renew.all='acme.sh --renew-all'
alias acme.upgrade='acme.sh --upgrade'
alias acme.update='acme.upgrade'

acme.get() {
  domain=$1
  if [ -n "${domain}" ]; then
    acme.sh --installcert -d ${domain} --key-file ${domain}.key --fullchain-file ${domain}.crt --capath ${domain}.ca
  else
    acme.list
  fi
}
